home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / moden / examples / exstat0.pas < prev    next >
Pascal/Delphi Source File  |  1996-04-08  |  2KB  |  76 lines

  1. unit Exstat0;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls, AdTerm, AdProtcl, AdPort;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     ApdComPort1: TApdComPort;
  12.     ApdProtocol1: TApdProtocol;
  13.     ApdTerminal1: TApdTerminal;
  14.     Panel1: TPanel;
  15.     BytesTransferred: TLabel;
  16.     FileName: TLabel;
  17.     BytesRemaining: TLabel;
  18.     FN: TLabel;
  19.     BT: TLabel;
  20.     BR: TLabel;
  21.     StartTransmit: TButton;
  22.     Cancel: TButton;
  23.     Msg: TLabel;
  24.     MS: TLabel;
  25.     procedure ApdProtocol1ProtocolStatus(CP: TObject; Options: Word);
  26.     procedure StartTransmitClick(Sender: TObject);
  27.     procedure CancelClick(Sender: TObject);
  28.     procedure ApdProtocol1ProtocolFinish(CP: TObject; ErrorCode: Integer);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34.  
  35. var
  36.   Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. {$R *.DFM}
  41.  
  42. procedure TForm1.ApdProtocol1ProtocolStatus(CP: TObject; Options: Word);
  43. begin
  44.   case Options of
  45.     apFirstCall : {do setup stuff} ;
  46.     apLastCall  : {do cleanup stuff} ;
  47.     else begin    {show status}
  48.       FN.Caption := ApdProtocol1.FileName;
  49.       BT.Caption := IntToStr(ApdProtocol1.BytesTransferred);
  50.       BR.Caption := IntToStr(ApdProtocol1.BytesRemaining);
  51.       MS.Caption := ApdProtocol1.StatusMsg(ApdProtocol1.ProtocolStatus);
  52.     end;
  53.   end;
  54. end;
  55.  
  56. procedure TForm1.StartTransmitClick(Sender: TObject);
  57. begin
  58.   ApdTerminal1.Active := False;
  59.   ApdProtocol1.StartTransmit;
  60. end;
  61.  
  62. procedure TForm1.CancelClick(Sender: TObject);
  63. begin
  64.   ApdProtocol1.CancelProtocol;
  65.   ApdTerminal1.SetFocus;
  66. end;
  67.  
  68. procedure TForm1.ApdProtocol1ProtocolFinish(CP: TObject;
  69.   ErrorCode: Integer);
  70. begin
  71.   ApdTerminal1.Active := True;
  72.   ApdTerminal1.SetFocus;
  73. end;
  74.  
  75. end.
  76.